<!--
 * @Description: 招聘-人才
 * @Author: rcc
 * @Date: 2024-08-08 11:40:04
 * @FilePath: /rc-recruitment/pages/tab-page/hiring-talent/hiring-talent.vue
-->

<template>
	<view class="page">
		<up-navbar title="找人才" placeholder :fixed="false" :titleStyle="{
			'color': '#fff',
			'font-size': '34rpx',
			'font-weight': 'bold',
		}" bgColor="#1269FF">
			<template #left>
				<view class="flex"></view>
			</template>
		</up-navbar>

		<view class="top-view p-h24 p-v20">
			<SearchView @blur="handleSeach" v-model="title" />
			<FilterView @change="onFilterChange" />
		</view>

		<view class="section m-h24 m-t30 p-h20">
			<view class="card flex" v-for="item in list" :key="item.id" @click="toResumePage(item.id)">
				<image class="cover" :src="item.avatar" mode="aspectFill"></image>

				<view class="flex-1 m-l20">
					<view class="flex">
						<text class="flex-1 text-700-130">{{ item.nickname }}</text>
						<!-- <text class="text-700-530">{{ item.job.length > 0 ? item.job[0].position : '--' }}</text> -->
					</view>
					<view class="flex m-t10">
						<text class="flex-1 text-400-326"> {{ item.highest_education || '无' }} | {{ item.work }}年工作经验 | 全职 </text>
						<!-- <text class="text-400-326">{{ getDateDiff(item.educate[0].createtime) }}</text> -->
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script lang="ts" setup>
import SearchView from './components/search.vue'
import FilterView from './components/filter.vue'
import type { TResume } from '@/types/api.d'
import { useRequest } from '@/hooks/use-request'
import { getDateDiff } from '@/utils/utils'
import { ref } from 'vue'
const list = ref<[]>([])
const title = ref<string>()
async function getList() {
	const res = await uni.$u.get('/resume/newresume', { title: title.value })
	list.value = res.data
}
const toResumePage = (id: number) => {
	uni.navigateTo({ url: '/pages/office/resume/resume?user_id=' + id })
}
function handleSeach() {
	getList()
}

const onFilterChange = () => {
	getList()
}
getList()
</script>

<style lang="scss" scoped>
.page {
	width: 100%;
	min-height: 100%;
	padding-bottom: 20rpx;
	// #ifdef H5
	padding-bottom: 120rpx;
	// #endif
	background-color: $page-color-4;
}

.top-view {
	background-color: $bg-color-1;
}

.section {
	border-radius: 10rpx;
	background-color: $page-color-1;

	.card {
		height: 146rpx;
		border-bottom: 1rpx solid $border-color-4;

		&:last-child {
			border: none;
		}
	}

	.cover {
		width: 102rpx;
		height: 102rpx;
		border-radius: 10rpx;
		border: 1rpx solid $border-color-4;
	}
}
</style>